import 'package:flutter_taotaoshipin/http/request/video_geturl_request.dart';
import 'package:flutter_taotaoshipin/model/base_entity.dart';
import 'package:flutter_taotaoshipin/model/video_geturl_entity.dart';
import 'package:flutter_taotaoshipin/value/constant.dart';
import 'package:hi_net/hi_net.dart';

class VideoDao {
  /// 获取视频地址和视频信息
  static Future<BaseEntity<VideoGeturlEntity>> getUrl({
    required int dramaId,
    required String vId,
    String format = 'hls',
    String fileType = 'video',
    String ssl = '0',
    String playScene = '',
    String domain = '',
    int typeId = 0, // 是否正剧 0 为正剧 1为非正剧
    int isSelf = 1, // 是否自制剧 0 否 1 是
  }) async {
    var request = VideoGeturlRequest();
    request.add('drama_id', dramaId);
    request.add('vid', vId);
    request.add('format', format);
    request.add('file_type', fileType);
    request.add('ssl', ssl);
    request.add('play_scene', playScene);
    request.add('domain', domain);
    request.add('type_id', typeId);
    request.add('is_self', isSelf);
    var result = await HiNet.getInstance().fire(request);
    return BaseEntity<VideoGeturlEntity>.fromJson(result);
  }
}
